package com.learn.yh.aws;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import java.util.HashMap;
import java.util.Map;

/**
 * @author: Yh
 * @date: 2021/4/7 9:35
 */
@JsonIgnoreProperties
public class AwsSecret {
    private String username;
    private String password;

    public String getUsername() {
        return username;
    }

    public AwsSecret setUsername(String username) {
        this.username = username;
        return this;
    }

    public String getPassword() {
        return password;
    }

    public AwsSecret setPassword(String password) {
        this.password = password;
        return this;
    }

    public Map<String, Object> replace(String key) {
        Map<String, Object> target = new HashMap<>();
        if (username != null && !username.isEmpty()) {
            target.put(key + ".username", username);
        }
        if (password != null && !password.isEmpty()) {
            target.put(key + ".password", password);
        }
        return target;
    }
}
